package com.cn.wanxi.servlet;

import com.cn.wanxi.dto.CommonModelDto;
import com.cn.wanxi.service.impl.CommonServiceImpl;
import com.cn.wanxi.service.ICommonService;
import net.sf.json.JSONArray;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/common")
public class CommonServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        ICommonService iCommonService=new CommonServiceImpl();
        CommonModelDto commonModelDto=iCommonService.getCommonDtoModel();

        JSONArray jsonArray = JSONArray.fromObject(commonModelDto);
        System.out.println(jsonArray.toString());
        resp.getWriter().println(jsonArray);
    }
}
